﻿<UserControl 
    x:Class="myManga.Views.ReadingView"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    TabIndex="0"
    TextElement.Foreground="White"
    FocusManager.FocusedElement="{Binding RelativeSource={RelativeSource Self}}">
    <UserControl.InputBindings>
        <KeyBinding Key="Left" Command="{Binding Path=PrevPage}"/>
        <KeyBinding Key="BrowserForward" Command="{Binding Path=PrevPage}"/>
        <KeyBinding Key="Right" Command="{Binding Path=NextPage}"/>
        <KeyBinding Key="BrowserBack" Command="{Binding Path=NextPage}"/>
    </UserControl.InputBindings>
    <Grid Background="Black" Focusable="False">
        <Grid.RowDefinitions>
            <RowDefinition/>
            <RowDefinition Height="Auto"/>
        </Grid.RowDefinitions>
        <ContentControl
            Content="{Binding Path=PageView}"
            Focusable="False"
            Grid.Row="0" 
            IsTabStop="False" 
            SnapsToDevicePixels="True" />
        <Grid VerticalAlignment="Top" Margin="21,0">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto"/>
                <ColumnDefinition/>
                <ColumnDefinition Width="Auto"/>
            </Grid.ColumnDefinitions>
            <Border
                Grid.Column="0">
                <Border.Background>
                    <RadialGradientBrush>
                        <GradientStop Color="Black" Offset="0" />
                        <GradientStop Color="#00000000" Offset="1" />
                    </RadialGradientBrush>
                </Border.Background>
                <Button 
                    Style="{StaticResource GlowBtn}" 
                    Command="{Binding Path=PrevPage}">
                    <Image 
                        Source="/myManga;component/Resources/Images/Metro/White/No Circle/back.png" 
                        Stretch="None"/>
                </Button>
            </Border>
            <Border
                Grid.Column="2">
                <Border.Background>
                    <RadialGradientBrush>
                        <GradientStop Color="Black" Offset="0" />
                        <GradientStop Color="#00000000" Offset="1" />
                    </RadialGradientBrush>
                </Border.Background>
                <Button 
                    Style="{StaticResource GlowBtn}" 
                    Command="{Binding Path=NextPage}">
                    <Image 
                        Source="/myManga;component/Resources/Images/Metro/White/No Circle/next.png" 
                        Stretch="None"/>
                </Button>                
            </Border>
        </Grid>
        <Grid 
            Grid.Row="1">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto"/>
                <ColumnDefinition/>
                <ColumnDefinition Width="Auto"/>
            </Grid.ColumnDefinitions>
            
            <Grid Grid.Column="1">
                <Grid.RowDefinitions>
                    <RowDefinition/>
                    <RowDefinition/>
                </Grid.RowDefinitions>
                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition/>
                        <ColumnDefinition Width="Auto" />
                    </Grid.ColumnDefinitions>
                    <TextBlock
                        TextAlignment="Center"
                        Padding="0,5"
                        Text="{Binding Path=ChapterName, FallbackValue=No\ File}" 
                        TextTrimming="CharacterEllipsis" />
                    <Slider 
                        Grid.Column="1" 
                        Height="30"
                        Opacity="50"
                        Width="150" 
                        Orientation="Horizontal" 
                        Value="{Binding ImageZoom}"
                        Minimum="0.75"
                        Maximum="2" 
                        LargeChange="0.1" 
                        SmallChange="0.05" 
                        Focusable="False" 
                        MouseDown="Slider_MouseDown" />
                </Grid>
                <Grid Grid.Row="1">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="*" />
                        <ColumnDefinition Width="Auto" MinWidth="50"/>
                    </Grid.ColumnDefinitions>
                    <ComboBox
                    ItemsSource="{Binding Path=ArchiveInfo.PageEntries}"
                    SelectedIndex="{Binding Path=ChapterIndex, Mode=TwoWay}"
                    Focusable="False"/>
                    <TextBlock
                    Text="{Binding Path=ArchiveInfo.PageEntries.Count, StringFormat=of\ {0}, FallbackValue=of\ 0}" 
                    Grid.Column="1" TextAlignment="Center" VerticalAlignment="Center"/>
                </Grid>
            </Grid>
            <Border
                Grid.Column="0">
                <Border.Background>
                    <RadialGradientBrush>
                        <GradientStop Color="Black" Offset="0" />
                        <GradientStop Color="#00000000" Offset="1" />
                    </RadialGradientBrush>
                </Border.Background>
                <Button 
                    Style="{StaticResource GlowBtn}" 
                    Command="{Binding Path=PrevPage}">
                    <Image 
                        Source="/myManga;component/Resources/Images/Metro/White/No Circle/back.png" 
                        Stretch="None"/>
                </Button>
            </Border>
            <Border
                Grid.Column="2">
                <Border.Background>
                    <RadialGradientBrush>
                        <GradientStop Color="Black" Offset="0" />
                        <GradientStop Color="#00000000" Offset="1" />
                    </RadialGradientBrush>
                </Border.Background>
                <Button 
                    Style="{StaticResource GlowBtn}" 
                    Command="{Binding Path=NextPage}">
                    <Image 
                        Source="/myManga;component/Resources/Images/Metro/White/No Circle/next.png" 
                        Stretch="None"/>
                </Button>
            </Border>
        </Grid>
        <ProgressBar
            Value="{Binding Path=Progress, Mode=OneWay, FallbackValue=50}"
            VerticalAlignment="Bottom"
            IsHitTestVisible="False"
            Visibility="{Binding Path=ProgressVisibility}"
            Margin="0,0,0,-7"/>
    </Grid>
</UserControl>
